package com.elephant.core.socket.socket1;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.Socket;

/**
 * 1、客户端写服务端读
 * @author hai
 * @description
 * @date 10:43 2018/8/31
 */
public class Client {

    public static void main(String[] args) throws IOException {

        String host = "127.0.0.1";
        Integer port = 8888;
        Socket socket = new Socket(host,port);
        Writer writer = new OutputStreamWriter(socket.getOutputStream());
        writer.write("hello world");
        writer.flush();

        writer.close();
        socket.close();
    }
}
